<?php if ( ! defined('WDK_PATH')) exit('No direct script access allowed');?>
<!--{**************************************************************************}-->
<style>
.upload_files 				{padding:3px;}
.upload_files span.removed	{color:red;text-decoration: line-through;}
</style>
<!--{**************************************************************************}-->
<form id="postForm" action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="bbs_id" value="{bbs.bbs_id}"/>
<input type="hidden" name="post_seq" value="{data.post_seq}"/>
<table class="form">
	<colgroup>
		<col style="width:20%;"/>
		<col style="width:30%;"/>
		<col style="width:20%;"/>
		<col style="width:30%;"/>
	</colgroup>
	<tbody>
		<!--{? bbs.bbs_category_flag == 'T' }-->
		<tr>
			<th>카테고리</th>
			<td colspan="3">
				<select name="fk_category_seq">
					<!--{@ bbs.categories }-->
					<option value='{.category_seq}'<!--{? .category_seq == data.fk_category_seq}--> selected="selected"<!--{/}-->>{.category_name}</option>
					<!--{/}-->
				</select>
			</td>
		</tr>
		<!--{/}-->
		<tr>
			<th>제목 <em>*</em></th>
			<td colspan="3"><input type="text" name="post_title" value="{data.post_title}" class="input" style="width:98%"/></td>
		</tr>
		<tr>
			<th>참조 URL</th>
			<td colspan="3"><input type="text" name="post_ref_url" value="{data.post_ref_url}" class="input" style="width:98%"/></td>
		</tr>
		<!--{? bbs.bbs_secure_flag == 'T' }-->
		<tr>
			<th>비밀글</th>
			<td colspan="3">
				<input type="radio" name="post_secure_flag" value="T" id="r2t"<!--{? data.post_secure_flag != 'F'}--> checked="checked"<!--{/}-->/> <label for="r2t">사용</label>
				<input type="radio" name="post_secure_flag" value="F" id="r2f"<!--{? data.post_secure_flag == 'F'}--> checked="checked"<!--{/}-->/> <label for="r2f">사용안함</label>
			</td>
		</tr>
		<!--{/}-->
		<!--{@ bbs.bbs_option_fields }-->
		<tr>
			<th>{.name} <!--{?.must=='T'}--><em>*</em><!--{/}--></th>
			<td colspan="3">
				<!--{@.values_arr}-->
				<input type="radio" name="post_option_field{.index_+1}" value="{..value_}" id="bof_{.index_}_{..index_}"/>
				<label for="bof_{.index_}_{..index_}">{..value_}</label>
				<!--{/}-->
			</td>
		</tr>
		<!--{/}-->
		<tr>
			<th>내용 <em>*</em></th>
			<td colspan="3">
				<textarea id="post_content" name="post_content" class="nicedit" style="height:250px;">{data.post_content}</textarea>
			</td>
		</tr>
		<tr>
			<th>태그 </th>
			<td colspan="3">
				<input type="text" name="post_tag" value="{data.post_tag}" class="input" style="width:60%"/>
				(태그가 여러개인경우 , 를 구분자로 하여 등록)
			</td>
		</tr>
		<!--{? bbs.bbs_file_flag == 'F' }-->
		<tr>
			<th>첨부파일</th>
			<td colspan="3">
				<div class="wduploader"></div>
			</td>
		</tr>
		<!--{/}-->
		<!--{?  !session.is_login && bbs.bbs_captcha_flag == 'T' }-->
		<tr>
			<th>입력보완</th>
			<td>
				<img src="/post/captcha"/>
			</td>
			<th>코드입력 <em>*</em></th>
			<td>
				<input type="text" name="post_captcha_code" class="input" size="20"/>
			</td>
		</tr>
		<!--{/}-->
	</tbody>
	<tfoot>
		<tr>
			<td	colspan="4">
				<div class="fl">
					<a id="btn_list" class="btn" href="javascript:;">목록</a>
				</div>
				<div class="fr">
					<!--{? data.post_seq > 0}-->
					<a id="btn_del" class="btn" href="javascript:;">삭제</a>
					<a id="btn_submit" class="btn" href="javascript:;">수정</a>
					<!--{:}-->
					<a id="btn_submit" class="btn" href="javascript:;">등록</a>
					<!--{/}-->
				</div>
			</td>
		</tr>
	</tfoot>
</table>
</form>
{# plugin uploader #}
{# plugin nicedit #}
<!--{**************************************************************************}-->
<script>
(function($){
	var bbs_seq = $('#postForm>:hidden[name=bbs_seq]').val();
	var bbs_id = $('#postForm>:hidden[name=bbs_id]').val();
	$('#btn_list').click(function(){
		location.href = $PATH+bbs_id;
	});
	$('#btn_submit').click(function(){
		if($('#postForm :text[name=post_title]').val() == '')
		{
			alert('제목을 입력하십시오.');
			return $('#postForm :text[name=post_title]').focus();
		}
//		if($('#postForm textarea[name=post_content]').val() == '')
//		{
//			return alert('내용을 입력하십시오.');
//		}
		if($('#postForm :text[name=post_captcha_code]').length == 1 &&  $('#postForm :text[name=post_captcha_code]').val() == '')
		{
			alert('입력보완 코드를 입력하십시오.');
			return $('#postForm :text[name=post_captcha_code]').focus();
		}
		
		if(confirm($('#btn_submit').text()+'하시겠습니까?'))
		{
			$('#postForm').submit();
		}
	});
	$('.remove_file').click(function(){
		if(this.checked)
		{
			$(this).closest('div').children('span').addClass('removed');
			$(this).closest('div').children(':file').removeAttr('disabled');
		}
		else
		{
			$(this).closest('div').children('span').removeClass('removed');
			$(this).closest('div').children(':file').attr('disabled','disabled');
		}
	});
})(jQuery); 
</script>
<!--{**************************************************************************}-->